package com.demotest.service.util;

import java.io.File;

public class FileUtil {

    /**
     * 获取资源路径
     * @return
     */
    public static String getResourcePath(String fileP){
        String filePath = String.valueOf(Thread.currentThread().getContextClassLoader().getResource(""));	//项目路径
        filePath = filePath.replaceAll("file:/", "");
        filePath = filePath.replaceAll("%20", " ");
        filePath = filePath.trim() + fileP.trim();
        if(filePath.indexOf(":") != 1){
            filePath = File.separator + filePath;
        }

        return filePath;
    }
}
